UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e2aYr/cgXtlv0emOjnWfYXR6LKXJ4jT1U4UmB4dkTJw=' 
WHERE 
  key_id = 'be1134f1dc909129590733032061f11c00407285564ca8128b8994f4e7daf8e3' 
  AND (
    token = 'e2aYr/cgXtlv0emOjnWfYXR6LKXJ4jT1U4UmB4dkTJw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051