UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UwZHheYBETVxaGxhI6fPBVjL81s4kDAI7aochgow8ug=' 
WHERE 
  key_id = '811fa7209ff3ec0ce1ee0b4a0ad1946311ac9bfce746f6a1d7a48f0c050922ca' 
  AND (
    token = 'UwZHheYBETVxaGxhI6fPBVjL81s4kDAI7aochgow8ug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022