UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fvJSVShEldAepjmJlr0nZBEuUwqRbb3kcTznB1dePXE=' 
WHERE 
  key_id = '67c516af949011c896a892123e6100ec31bc6f6ae1dfce4ea4817c52fdb6206d' 
  AND (
    token = 'fvJSVShEldAepjmJlr0nZBEuUwqRbb3kcTznB1dePXE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045