UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z4VMS3m+ZbopyPxmcn7rnTG0RW9JKJziAr/AUdsZIsQ=' 
WHERE 
  key_id = 'b9f34319edcfed09bc8a422dce4f8c35bfc69290072e93a5563afc74c9d3ab89' 
  AND (
    token = 'Z4VMS3m+ZbopyPxmcn7rnTG0RW9JKJziAr/AUdsZIsQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047