UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mmDkCyLnis/5eskrpz/lw7ktVydMR34SBksSttKUCdQ=' 
WHERE 
  key_id = '8825aa006161e0e8372fd0a5b0f308c4651e8eb452fa14c5f18d2476bc26aa52' 
  AND (
    token = 'mmDkCyLnis/5eskrpz/lw7ktVydMR34SBksSttKUCdQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052