UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b+U18S6w23GhxPDVkFbufgl8lsJycvzlXohME0inQtU=' 
WHERE 
  key_id = 'f0cb45d87c3da21daa2bc09e05742489b6bc35a7e23a89bb7d6c3f6242a644e9' 
  AND (
    token = 'b+U18S6w23GhxPDVkFbufgl8lsJycvzlXohME0inQtU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024