UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KreBmTuvV4ew0NcQoJ4ETwqrHoC6ASwCWN+02LiwGxg=' 
WHERE 
  key_id = '09d2a621549facd97ca7482d6881cbbf121e986ccb3a6642880a96234d5888da' 
  AND (
    token = 'KreBmTuvV4ew0NcQoJ4ETwqrHoC6ASwCWN+02LiwGxg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037