UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'orReZwiOjtb71Bjo+W9kfsDuHZeCpgglCH+kAUgIrZ8=' 
WHERE 
  key_id = 'cb91b41f165febf10c74814979e48de1dd4e295595197beb74e0ee1be4011673' 
  AND (
    token = 'orReZwiOjtb71Bjo+W9kfsDuHZeCpgglCH+kAUgIrZ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028