UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fE51j9TuR1kTLk1EwAKNiahMfpbz+zMVxSRxNxmVBIs=' 
WHERE 
  key_id = '8e12bcecbf646a042c0f0861bea1ab3046f274d8b2f82ef86c3b98d5652d5ee6' 
  AND (
    token = 'fE51j9TuR1kTLk1EwAKNiahMfpbz+zMVxSRxNxmVBIs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041