UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QfsFugXXJdEPymijQnB7hfxzrqoiCToguLv3+AD9Ysw=' 
WHERE 
  key_id = '7c6321b651688b1b90379d8e29d94ba0ffc20c42ae01dba0c0cbf86d7f66748e' 
  AND (
    token = 'QfsFugXXJdEPymijQnB7hfxzrqoiCToguLv3+AD9Ysw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037