UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VX1s7f+WyANTgCZ+2bYUqmCiyNhW3P41ql3PIKtGIaA=' 
WHERE 
  key_id = 'a9adcaefcd37170a57295f2e1b3dcbc7bd1ecd69998bb2cc4ddd36c6cac01a0f' 
  AND (
    token = 'VX1s7f+WyANTgCZ+2bYUqmCiyNhW3P41ql3PIKtGIaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030