UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XO/2rFk+sOXpbt6hL65t3/zKA/S6qZZ3HWlMzjeXLXE=' 
WHERE 
  key_id = '0e8589795f5d063e58e9840f1ea013d05c63448375a923948d8c6eca861ade07' 
  AND (
    token = 'XO/2rFk+sOXpbt6hL65t3/zKA/S6qZZ3HWlMzjeXLXE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058