UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Iv4yAyiaUIOAVQ28hO+YCPphCR4SYrvFfOxP7tM8mpE=' 
WHERE 
  key_id = 'e7dbedf1d6517d756e4d34c6fef41fcc4e6ea3404cfb5ac1677283ba2c838475' 
  AND (
    token = 'Iv4yAyiaUIOAVQ28hO+YCPphCR4SYrvFfOxP7tM8mpE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024