UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wKtgCcpT+ekVTvfyzHzupHttutTRbyE30Frcr5hQd0c=' 
WHERE 
  key_id = '6fa0b8e81239ba2e892b48988a7d12557cef12f860f3172248110d966cec77be' 
  AND (
    token = 'wKtgCcpT+ekVTvfyzHzupHttutTRbyE30Frcr5hQd0c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021