UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h1bAqP1bb91i/00J7c74ULhn46xGZMlIYsm0x5SAo3M=' 
WHERE 
  key_id = 'a113095766b26b3e8947def58fe23a1437f07f3d5862895ab4d8b1ea219461be' 
  AND (
    token = 'h1bAqP1bb91i/00J7c74ULhn46xGZMlIYsm0x5SAo3M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032