UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HcSDrUmLShEf4CaXhxNiTc1wITgqtOSsxNXikcCXfFs=' 
WHERE 
  key_id = '3d2788cde03a033b44b0c562511106c2ec57809496b2cf6b7ecc407e082f3c63' 
  AND (
    token = 'HcSDrUmLShEf4CaXhxNiTc1wITgqtOSsxNXikcCXfFs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036