UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YD2X19XTx/sIDKqH2dOt4UgnV0DetRpoNLlFhsd+UNs=' 
WHERE 
  key_id = '7629a866fbf9efd0d46d7ac167e99216c002876f1b8065ee1f23d73c4b0db988' 
  AND (
    token = 'YD2X19XTx/sIDKqH2dOt4UgnV0DetRpoNLlFhsd+UNs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033