UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BX7m8hF3Cztzek+Hq23w+AKBOGrjhihKc4Nw3CTqmIA=' 
WHERE 
  key_id = '8a858edb687045309da3fb0b2b3d80d561de381d35b3800fb600372cadd04ce0' 
  AND (
    token = 'BX7m8hF3Cztzek+Hq23w+AKBOGrjhihKc4Nw3CTqmIA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040