UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bnnC7AooAOePo7Zi0kSDZpIR938VTRtx6JR7bGGb8VU=' 
WHERE 
  key_id = '0323ce80e97115debfc358b0695b17a8c893a02c3ed1932283e8462e35c9fb52' 
  AND (
    token = 'bnnC7AooAOePo7Zi0kSDZpIR938VTRtx6JR7bGGb8VU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023