UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lPHAwtGqpKRskXV5h5OpOCCxeao/6Zdr2GTJV0r6V3Q=' 
WHERE 
  key_id = '50fe8749d277b564d7b3115f470b5298a68c940974c7e2d9b9ae2389091975e8' 
  AND (
    token = 'lPHAwtGqpKRskXV5h5OpOCCxeao/6Zdr2GTJV0r6V3Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050