UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bne/cq4IEehiRmS25rLlAacDpMY3nUfTbjlkiKD3Z14=' 
WHERE 
  key_id = 'a83ff4d3101ca7304d65e88fd98d0a0fec7c2c679d60bdc824dd74c6e613dcb4' 
  AND (
    token = 'Bne/cq4IEehiRmS25rLlAacDpMY3nUfTbjlkiKD3Z14=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023