UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ubw0WI8Hmfk74zAPkxdgBNK86ursWP9z8930w3o0Iz0=' 
WHERE 
  key_id = '48e3d47e134a8701c1a1d8935be9c86ae868d067e0c14e5d6947941e3d00e987' 
  AND (
    token = 'ubw0WI8Hmfk74zAPkxdgBNK86ursWP9z8930w3o0Iz0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030