UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k9ey17w2wC6k9cXkiq+9jaj3bLyXlWS65Umw47vcSDM=' 
WHERE 
  key_id = 'c8f9ae8770c80f910d6dc5f292c42caa75fd8bc668e6f282eb2fa1445e4cad31' 
  AND (
    token = 'k9ey17w2wC6k9cXkiq+9jaj3bLyXlWS65Umw47vcSDM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030