UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uiUB/RCNWyI8JHNqnvLq4aINeRpYLEEm/CTqs+7la8Q=' 
WHERE 
  key_id = '5710a106a0c22e38a5f5a549836d1cd296764a861d22c8ac03fcdfc83b3c3f4c' 
  AND (
    token = 'uiUB/RCNWyI8JHNqnvLq4aINeRpYLEEm/CTqs+7la8Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053