UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Df/V+xyfGWoS9gDTty/AfPcBKrGM9zcrq9v19qqz1n4=' 
WHERE 
  key_id = '0172070011cbab41eaa418a60139d71481977f3a90a76fe843b7aa33f6ce31ca' 
  AND (
    token = 'Df/V+xyfGWoS9gDTty/AfPcBKrGM9zcrq9v19qqz1n4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040