UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/1alNwi+Q3zqVUyKigfwTz+kcPcx7kFamK35Npz0Xt4=' 
WHERE 
  key_id = 'a852215826bd83e94453de9a4643b50d9fe36001394bcd9e49f2306e38837991' 
  AND (
    token = '/1alNwi+Q3zqVUyKigfwTz+kcPcx7kFamK35Npz0Xt4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031