UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Npmj9zlY8vJFk/312iLx6zDADGBw8P+wUkU3Gt+/fCE=' 
WHERE 
  key_id = '274c8507787642e2961be9ead834f13e25e9dc8f6ce9dba4a1c6c40c8408b531' 
  AND (
    token = 'Npmj9zlY8vJFk/312iLx6zDADGBw8P+wUkU3Gt+/fCE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036