UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YFUzMHGnRCAnLbZCuQd5vPA+caiPnvaVPUmsmKJzAIc=' 
WHERE 
  key_id = 'bd6e4a575de673d7938a0166487579747f81b7d11bafa7d06ec232c7295bf632' 
  AND (
    token = 'YFUzMHGnRCAnLbZCuQd5vPA+caiPnvaVPUmsmKJzAIc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032