UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OkJzbp21lhmz0R718iYCsA0LoiMfU3X4ukRmPhAJY3c=' 
WHERE 
  key_id = '0afc7214e42f47f0eba34a2306d8aec2dcdef3eaaae78ef7bd64c6b0b3f767b7' 
  AND (
    token = 'OkJzbp21lhmz0R718iYCsA0LoiMfU3X4ukRmPhAJY3c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031