UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BxZSSTLKv14mdD+MNyJpZvCV+8H0CXHUvnMNAOiMjMA=' 
WHERE 
  key_id = '2d84b5f6b54cee1d0e6f29685344974b3176a7df95626496e192205c3dcb19f5' 
  AND (
    token = 'BxZSSTLKv14mdD+MNyJpZvCV+8H0CXHUvnMNAOiMjMA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034