UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OgnNYRARRWc8k2nvs0tFFVfKbKd9EswzWC776QX7xLA=' 
WHERE 
  key_id = '9f2b412979c51b504c6b66f7d5b005c5f8c1707fe1d6a1ae66e1eb32e136486a' 
  AND (
    token = 'OgnNYRARRWc8k2nvs0tFFVfKbKd9EswzWC776QX7xLA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024