UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I5R3j9tt4n/vapvEb0GAGDB8nQhMq0ZJw1t309vCh5Q=' 
WHERE 
  key_id = '16a32a7f89316bfc8ccf2c522da3e34f2b1b694cdb690ad3c617cfcc7eb8d50b' 
  AND (
    token = 'I5R3j9tt4n/vapvEb0GAGDB8nQhMq0ZJw1t309vCh5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029