UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HGb0XCAnoGQk7lX/QpbeGvpRfQCF0rjH+EGdR2Fzcdk=' 
WHERE 
  key_id = '983351c5a6f183a000540bbf3801a6ba206eaf7116b97bfb3cea4a55a52df115' 
  AND (
    token = 'HGb0XCAnoGQk7lX/QpbeGvpRfQCF0rjH+EGdR2Fzcdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030