UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lljatj8c0MuzMSBebF7WaHhW9CPNL8t+4DEp3tfUOVY=' 
WHERE 
  key_id = '5a61496a99c7e2ccfb2c7e2e8811a5405abd14320d1d1698d08ad6d1ef656ddc' 
  AND (
    token = 'Lljatj8c0MuzMSBebF7WaHhW9CPNL8t+4DEp3tfUOVY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040