UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mr05IGzd6DtW9D3lnq7EDLyKFhnk2i5KojdxEYPqdTM=' 
WHERE 
  key_id = '98847b14a8dbad4002bfec2297e51205959b5c5fd1327312d9d968e5ac6fc1ff' 
  AND (
    token = 'mr05IGzd6DtW9D3lnq7EDLyKFhnk2i5KojdxEYPqdTM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016