UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZHk6A/a5XmXfuUlFtTq7zGh1U5zPIJRMTC5DAb4Ldpc=' 
WHERE 
  key_id = 'bdcec99290dc8d32890d3336f220e3929b9c968a6a4f16a83baf645631f12ec8' 
  AND (
    token = 'ZHk6A/a5XmXfuUlFtTq7zGh1U5zPIJRMTC5DAb4Ldpc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047